home *** CD-ROM | disk | FTP | other *** search
- // remove a specific XMP property for the selected images
-
- var
- AProperty, AId: String;
- AXmp: TXMP;
- AParam: TMacroParam;
- i, AHit: Integer;
- ACatItem: TCatalogItem;
- begin
- AProperty := ReadFromRegistry ('Scripts\Remove XMP property', 'Property', 'dc:subject');
-
- if not InputQuery ('Enter XMP property', 'Property: ', AProperty) then
- exit;
-
- AProperty := Trim(AProperty);
- if (AProperty = '') or (Pos (':', AProperty) < 2) then
- begin
- Say ('No XMP property specified or no valid property specified. Make sure the property contains a ssemi-colon (:) character.');
- exit;
- end;
-
- WriteToRegistry ('Scripts\Remove XMP property', 'Property', AProperty);
-
- AId := LeftStr (AProperty, Pos(':', AProperty) - 1);
-
- AHit := 0;
-
- for i := 0 to Selected.Count - 1 do
- begin
- AXmp := TXMP.Create (False);
-
- Catalog.LoadXMPForImage (Selected.Items[i], AXmp, Options.CachedXMP);
-
- AParam := AXmp.XMPDesign.FindIdCommand (AId, AProperty, True);
-
- if AParam <> nil then
- begin
- // Say (AParam.StrContent);
-
- // delete the property
- AParam.Free;
- Catalog.SaveXMPForImage (Selected.Items[i], AXmp, Options.CachedXMP);
- Inc (AHit);
- end;
-
- AXmp.Free;
-
- ACatItem.Free;
- end;
-
- Say (Format ('Done; %d removed', [AHit]));
- end;
-